
(function () {
    var core = ecui,
        util = core.util,
        ui = ecui.ui,
        dom = ecui.dom;

    Object.assign(
        NS.data,
        {
        }
    );
    Object.assign(
        NS.ui,
        {
            // 评论按钮
            CommentSave: core.inherits(
                mao.ui.CommentSave,
                {
                    onsubmit: function () {
                        if (this._oRequest) {
                            return;
                        }
                        this._oRequest = true;
                        var data = {};
                        var form = this.getInput().form;
                        ecui.esr.parseObject(form, data);
                        delete data.action;
                        ecui.esr.setData('commentParam', data);
                        if (this.action === '7') {
                            // 评论
                            ecui.esr.request(
                                'data@JSON /erp-management/label-project/comment?${commentParam}',
                                function () {
                                    this._oRequest = false;
                                    var data = ecui.esr.getData('data');
                                    if (data instanceof Object) {
                                        ecui.tip('warn', '评论成功');
                                        var route = ecui.esr.findRoute(this.getMain());
                                        delete route.CACHE;
                                        ecui.esr.reload();
                                    }
                                }.bind(this),
                                function () {
                                    this._oRequest = false;
                                }.bind(this)
                            );
                        }
                    }
                }
            )
        }
    );
    ecui.esr.addRoute('detail', {
        model: ['detail@GET /erp-management/label-project/detail/${id}'],
        weight: 4,
        frame: true,
        onbeforerequest: function (context) {
            context.num = mao.util.getTimeRandom();
        },
        onbeforerender: function (context) {
        },
        onafterrender: function (context) {
        }
    });
}());

